var arrcredit = ['', '信用记录良好', '少量逾期', '征信较差'];
var arrhouse = ['', '无房产', '商品住房', '商铺', '写字楼', '厂房', '宅基地', '其他'];
var arrworklife = ['','一年以下', '1-3年', '3-5年', '5年以上'];
var arrcompanyType = ['', '政府或事业单位', '国企央企', '外资企业', '上市公司', '普通企业', '其他'];
var arrmarry = ['', '未婚', '已婚', '离异', '丧偶'];
var arrdegree = ['', '大专以下', '大专', '本科', '研究生及其以上'];
var arrcar = ['', '无车产', '有车产有抵押', '有车产无抵押'];
var pickerButton = document.getElementsByClassName("xfpicker");
var edu_degree = ""; //文化程度
var company_type = ""; //公司类型
var identity = 2; //用户身份
var real_name = ""; //用户姓名
var user_idnum = ""; //身份证号码
var marry = ""; //婚姻状况
var urgent_name = ""; //紧急联系人姓名
var urgent_tel = ""; //紧急联系人手机号
var credit_status = ""; //信用状况
var tel_time = ""; //手机号使用时间
var Istel_time = ""; //手机号使用时间
var credit_card = ""; //是否有信用卡
var Iscredit_card = ""; //是否有信用卡
var income = ""; //收入
var working_life = ""; //工作年限
var social_security = ""; //连续6个月以上缴纳社保
var Issocial_security = ""; //连续6个月以上缴纳社保
var housing_fund = ""; //连续6个月缴纳公积金
var Ishousing_fund = ""; //连续6个月缴纳公积金
var house_property = ""; //名下房产
var car_property = ""; //名下车产
var admission_time = ""; //入学时间
var school_name = ""; //学校名称
var loan_record = ""; //是否有贷款记录
var Isloan_record = ""; //是否有贷款记录
var stock = ""; //所持股份
var company_name = ""; //公司名称
var tb_account = ""; //是否有淘宝账号
var Istb_account = ""; //是否有淘宝账号
var real_name = ""; //真实姓名
var user_idnum = ""; //身份证号码
var numperson1 = 1;
var numperson2 = 1;
var numperson3 = 1;
var numperson4 = 0;

function isIdCard(cardid) {
	//身份证正则表达式(18位)
	var isIdCard2 = /^[1-9]\d{5}(19\d{2}|[2-9]\d{3})((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])(\d{4}|\d{3}X)$/i;
	var stard = "10X98765432"; //最后一位身份证的号码
	var first = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; //1-17系数
	var sum = 0;
	if(!isIdCard2.test(cardid)) {
		mui.toast('请输入有效的身份证号');
		return;
	}
	var year = cardid.substr(6, 4);
	var month = cardid.substr(10, 2);
	var day = cardid.substr(12, 2);
	var birthday = cardid.substr(6, 8);
	if(birthday != dateToString(new Date(year + '/' + month + '/' + day))) { //校验日期是否合法
		return false;
	}
	for(var i = 0; i < cardid.length - 1; i++) {
		sum += cardid[i] * first[i];
	}
	var result = sum % 11;
	var last = stard[result]; //计算出来的最后一位身份证号码
	if(cardid[cardid.length - 1].toUpperCase() == last) {
		return true;
	} else {
		mui.toast('请输入有效的身份证号');
		return;
	}
}

//console.log(user_idnum);
(function($, window, document, undefined) {
	$.ready(function() {
		var TelTime = new $.PopPicker(); //手机号使用时间
		pickistrue('work_people_TelTime', TelTime, tel_time, "tel_time", Istel_time);
		pickistrue('work_people_credit_card', TelTime, credit_card, "credit_card", Iscredit_card);
		pickistrue('work_people_tb_account', TelTime, tb_account, "tb_account", Istb_account);
		TelTime.setData([{
			value: 1,
			text: '是'
		}, {
			value: 0,
			text: '否'
		}]);
		function pickevent(mm, nn, cc, dd) {
			document.getElementById(mm).addEventListener('tap', function(event) {
				nn.show(function(items) {
					document.getElementById(mm).innerText = items[0].text;
					cc = items[0].value;
					document.getElementById(mm).style.color = 'black';
					localStorage.setItem(dd, cc);
					console.log(localStorage.getItem(dd));
						//返回 false 可以阻止选择框的关闭
						//return false;
				});
			}, false);
		}

		function pickistrue(mm, nn, cc, dd, ff) {
			document.getElementById(mm).addEventListener('tap', function(event) {
				nn.show(function(items) {
					document.getElementById(mm).innerText = items[0].text;
					ff = items[0].value;
					cc = items[0].text;
					//			price = cc.innerText;
					document.getElementById(mm).style.color = 'black';
					localStorage.setItem(dd, ff);
					console.log(localStorage.getItem(dd));
						//返回 false 可以阻止选择框的关闭
						//return false;
				});
			}, false);
		}
	});
})(window.mui || window, window, document, undefined);
